[id].vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. <template>
  2. <div>
  3. <div class="inner--headers">
  4. <h2>{{ pageId }}</h2>
  5. <div class="bread--crumbs--wrap">
  6. <span>홈</span>
  7. <span @click="goBack" class="breadcrumb-link">벤더사 관리</span>
  8. <span>{{ currentVendor?.name || "벤더사 상세" }}</span>
  9. </div>
  10. </div>
  11. <!-- 로딩 상태 -->
  12. <div v-if="isLoading" class="loading-wrap">
  13. <v-progress-circular indeterminate color="primary" size="64"></v-progress-circular>
  14. <p>벤더사 정보를 불러오고 있습니다...</p>
  15. </div>
  16. <!-- 에러 상태 -->
  17. <div v-else-if="errorMessage" class="error-wrap">
  18. <v-alert type="error" dismissible @click:close="vendorsStore.clearError()">
  19. {{ errorMessage }}
  20. </v-alert>
  21. <v-btn @click="goBack" class="custom-btn btn-blue">목록으로 돌아가기</v-btn>
  22. </div>
  23. <!-- 벤더사 상세 정보 -->
  24. <div v-else-if="currentVendor" class="vendor-detail-wrap">
  25. <!-- 벤더사 기본 정보 -->
  26. <v-card class="vendor-header-card" elevation="2">
  27. <v-card-text>
  28. <div class="vendor-header">
  29. <div class="vendor-logo-section">
  30. <v-avatar size="80" class="vendor-logo-large">
  31. <v-img
  32. v-if="currentVendor.logo"
  33. :src="currentVendor.logo"
  34. :alt="currentVendor.name + ' 로고'"
  35. ></v-img>
  36. <div v-else class="no-logo-large">{{ currentVendor.name.charAt(0) }}</div>
  37. </v-avatar>
  38. </div>
  39. <div class="vendor-info-section">
  40. <h1 class="vendor-name">{{ currentVendor.name }}</h1>
  41. <div class="vendor-meta">
  42. <v-chip
  43. :color="getCategoryColor(currentVendor.category)"
  44. size="large"
  45. variant="outlined"
  46. class="mr-2"
  47. >
  48. {{ getCategoryName(currentVendor.category) }}
  49. </v-chip>
  50. <v-chip
  51. :color="currentVendor.status === 'ACTIVE' ? 'success' : 'error'"
  52. size="large"
  53. >
  54. {{ currentVendor.status === "ACTIVE" ? "활성" : "비활성" }}
  55. </v-chip>
  56. </div>
  57. <p v-if="currentVendor.description" class="vendor-description">
  58. {{ currentVendor.description }}
  59. </p>
  60. </div>
  61. <div class="vendor-actions">
  62. <v-btn
  63. v-if="currentVendor.website"
  64. :href="currentVendor.website"
  65. target="_blank"
  66. class="custom-btn btn-white mr-2"
  67. prepend-icon="mdi-web"
  68. >
  69. 웹사이트
  70. </v-btn>
  71. <v-btn
  72. @click="goBack"
  73. class="custom-btn btn-blue"
  74. prepend-icon="mdi-arrow-left"
  75. >
  76. 목록으로
  77. </v-btn>
  78. </div>
  79. </div>
  80. </v-card-text>
  81. </v-card>
  82. <!-- 상세 정보 탭 -->
  83. <v-card class="detail-tabs-card" elevation="2">
  84. <v-tabs v-model="activeTab" class="custom-tabs">
  85. <v-tab value="info">기업 정보</v-tab>
  86. <v-tab value="contact">연락처</v-tab>
  87. <v-tab value="products">제품 정보</v-tab>
  88. <v-tab value="partnership">파트너십</v-tab>
  89. </v-tabs>
  90. <v-card-text>
  91. <v-tabs-window v-model="activeTab">
  92. <!-- 기업 정보 탭 -->
  93. <v-tabs-window-item value="info">
  94. <div class="info-section">
  95. <v-row>
  96. <v-col cols="12" md="6">
  97. <div class="info-item">
  98. <h3>사업자등록번호</h3>
  99. <p>{{ currentVendor.businessNumber || "-" }}</p>
  100. </div>
  101. </v-col>
  102. <v-col cols="12" md="6">
  103. <div class="info-item">
  104. <h3>설립일</h3>
  105. <p>{{ formatDate(currentVendor.establishedDate) || "-" }}</p>
  106. </div>
  107. </v-col>
  108. <v-col cols="12" md="6">
  109. <div class="info-item">
  110. <h3>직원 수</h3>
  111. <p>
  112. {{
  113. currentVendor.employeeCount
  114. ? currentVendor.employeeCount + "명"
  115. : "-"
  116. }}
  117. </p>
  118. </div>
  119. </v-col>
  120. <v-col cols="12" md="6">
  121. <div class="info-item">
  122. <h3>연매출</h3>
  123. <p>{{ formatCurrency(currentVendor.annualRevenue) || "-" }}</p>
  124. </div>
  125. </v-col>
  126. <v-col cols="12">
  127. <div class="info-item">
  128. <h3>사업 분야</h3>
  129. <div class="business-areas">
  130. <v-chip
  131. v-for="area in currentVendor.businessAreas || []"
  132. :key="area"
  133. size="small"
  134. variant="outlined"
  135. class="mr-2 mb-2"
  136. >
  137. {{ area }}
  138. </v-chip>
  139. </div>
  140. </div>
  141. </v-col>
  142. </v-row>
  143. </div>
  144. </v-tabs-window-item>
  145. <!-- 연락처 탭 -->
  146. <v-tabs-window-item value="contact">
  147. <div class="contact-section">
  148. <v-row>
  149. <v-col cols="12" md="6">
  150. <v-card variant="outlined" class="contact-card">
  151. <v-card-title>
  152. <v-icon class="mr-2">mdi-account</v-icon>
  153. 주요 담당자
  154. </v-card-title>
  155. <v-card-text>
  156. <div class="contact-item">
  157. <strong>이름:</strong> {{ currentVendor.contactName || "-" }}
  158. </div>
  159. <div class="contact-item">
  160. <strong>직책:</strong>
  161. {{ currentVendor.contactPosition || "-" }}
  162. </div>
  163. <div class="contact-item">
  164. <strong>전화:</strong>
  165. <a
  166. v-if="currentVendor.contactPhone"
  167. :href="`tel:${currentVendor.contactPhone}`"
  168. >
  169. {{ currentVendor.contactPhone }}
  170. </a>
  171. <span v-else>-</span>
  172. </div>
  173. <div class="contact-item">
  174. <strong>이메일:</strong>
  175. <a
  176. v-if="currentVendor.contactEmail"
  177. :href="`mailto:${currentVendor.contactEmail}`"
  178. >
  179. {{ currentVendor.contactEmail }}
  180. </a>
  181. <span v-else>-</span>
  182. </div>
  183. </v-card-text>
  184. </v-card>
  185. </v-col>
  186. <v-col cols="12" md="6">
  187. <v-card variant="outlined" class="contact-card">
  188. <v-card-title>
  189. <v-icon class="mr-2">mdi-map-marker</v-icon>
  190. 주소 정보
  191. </v-card-title>
  192. <v-card-text>
  193. <div class="contact-item">
  194. <strong>주소:</strong>
  195. <p>{{ currentVendor.address || "-" }}</p>
  196. </div>
  197. <div class="contact-item">
  198. <strong>상세주소:</strong>
  199. <p>{{ currentVendor.detailAddress || "-" }}</p>
  200. </div>
  201. <div class="contact-item">
  202. <strong>우편번호:</strong> {{ currentVendor.zipCode || "-" }}
  203. </div>
  204. </v-card-text>
  205. </v-card>
  206. </v-col>
  207. </v-row>
  208. </div>
  209. </v-tabs-window-item>
  210. <!-- 제품 정보 탭 -->
  211. <v-tabs-window-item value="products">
  212. <div class="products-section">
  213. <div class="section-header">
  214. <h3>주요 제품/서비스</h3>
  215. </div>
  216. <v-row v-if="currentVendor.products && currentVendor.products.length > 0">
  217. <v-col
  218. v-for="product in currentVendor.products"
  219. :key="product.id"
  220. cols="12"
  221. md="6"
  222. lg="4"
  223. >
  224. <v-card class="product-card" variant="outlined">
  225. <v-img
  226. v-if="product.image"
  227. :src="product.image"
  228. height="150"
  229. cover
  230. ></v-img>
  231. <v-card-title>{{ product.name }}</v-card-title>
  232. <v-card-text>
  233. <p>{{ product.description }}</p>
  234. <div class="product-price" v-if="product.price">
  235. {{ formatCurrency(product.price) }}
  236. </div>
  237. </v-card-text>
  238. </v-card>
  239. </v-col>
  240. </v-row>
  241. <div v-else class="no-data">
  242. <v-icon size="48" color="grey-lighten-1">mdi-package-variant</v-icon>
  243. <p>등록된 제품 정보가 없습니다</p>
  244. </div>
  245. </div>
  246. </v-tabs-window-item>
  247. <!-- 파트너십 탭 -->
  248. <v-tabs-window-item value="partnership">
  249. <div class="partnership-section">
  250. <v-row>
  251. <v-col cols="12" md="6">
  252. <div class="info-item">
  253. <h3>파트너십 등급</h3>
  254. <v-chip
  255. :color="getPartnershipColor(currentVendor.partnershipLevel)"
  256. size="large"
  257. >
  258. {{ getPartnershipName(currentVendor.partnershipLevel) }}
  259. </v-chip>
  260. </div>
  261. </v-col>
  262. <v-col cols="12" md="6">
  263. <div class="info-item">
  264. <h3>협력 시작일</h3>
  265. <p>{{ formatDate(currentVendor.partnershipStartDate) || "-" }}</p>
  266. </div>
  267. </v-col>
  268. <v-col cols="12" md="6">
  269. <div class="info-item">
  270. <h3>협력 프로젝트 수</h3>
  271. <p>{{ currentVendor.projectCount || 0 }}개</p>
  272. </div>
  273. </v-col>
  274. <v-col cols="12" md="6">
  275. <div class="info-item">
  276. <h3>평점</h3>
  277. <div class="rating">
  278. <v-rating
  279. v-model="currentVendor.rating"
  280. readonly
  281. size="small"
  282. density="compact"
  283. ></v-rating>
  284. <span class="rating-text">{{ currentVendor.rating || 0 }}/5</span>
  285. </div>
  286. </div>
  287. </v-col>
  288. <v-col cols="12">
  289. <div class="info-item">
  290. <h3>특이사항</h3>
  291. <p>{{ currentVendor.notes || "특이사항이 없습니다." }}</p>
  292. </div>
  293. </v-col>
  294. </v-row>
  295. </div>
  296. </v-tabs-window-item>
  297. </v-tabs-window>
  298. </v-card-text>
  299. </v-card>
  300. </div>
  301. <!-- 데이터가 없을 때 -->
  302. <div v-else class="no-data-wrap">
  303. <div class="no-data">
  304. <v-icon size="64" color="grey-lighten-1">mdi-store-alert</v-icon>
  305. <h3>벤더사 정보를 찾을 수 없습니다</h3>
  306. <p>요청하신 벤더사가 존재하지 않거나 삭제되었을 수 있습니다</p>
  307. <v-btn @click="goBack" class="custom-btn btn-blue">목록으로 돌아가기</v-btn>
  308. </div>
  309. </div>
  310. </div>
  311. </template>
  312. <script setup>
  313. import { ref, onMounted, computed } from "vue";
  314. import { useRoute, useRouter } from "vue-router";
  315. import { useVendorsStore } from "@/stores/vendors";
  316. /************************************************************************
  317. | 레이아웃
  318. ************************************************************************/
  319. definePageMeta({
  320. layout: "default",
  321. });
  322. /************************************************************************
  323. | 스토어, 라우터, 라우트
  324. ************************************************************************/
  325. const vendorsStore = useVendorsStore();
  326. const router = useRouter();
  327. const route = useRoute();
  328. /************************************************************************
  329. | 반응형 데이터
  330. ************************************************************************/
  331. const pageId = ref("벤더사 상세");
  332. const activeTab = ref("info");
  333. /************************************************************************
  334. | computed - 안전한 접근 방식
  335. ************************************************************************/
  336. const currentVendor = computed(() => {
  337. try {
  338. return vendorsStore.getCurrentVendor || null;
  339. } catch (error) {
  340. console.error("getCurrentVendor 접근 오류:", error);
  341. return null;
  342. }
  343. });
  344. const isLoading = computed(() => {
  345. try {
  346. return vendorsStore.getLoading || false;
  347. } catch (error) {
  348. console.error("getLoading 접근 오류:", error);
  349. return false;
  350. }
  351. });
  352. const errorMessage = computed(() => {
  353. try {
  354. return vendorsStore.getError || null;
  355. } catch (error) {
  356. console.error("getError 접근 오류:", error);
  357. return null;
  358. }
  359. });
  360. /************************************************************************
  361. | 메서드
  362. ************************************************************************/
  363. const goBack = () => {
  364. router.push("/view/vendor/vendors");
  365. };
  366. const getCategoryColor = (category) => {
  367. const colors = {
  368. FASHION_BEAUTY: "pink",
  369. FOOD_HEALTH: "green",
  370. LIFESTYLE: "blue",
  371. TECH_ELECTRONICS: "purple",
  372. SPORTS_LEISURE: "orange",
  373. CULTURE_ENTERTAINMENT: "red",
  374. };
  375. return colors[category] || "grey";
  376. };
  377. const getCategoryName = (category) => {
  378. const names = {
  379. FASHION_BEAUTY: "패션·뷰티",
  380. FOOD_HEALTH: "식품·건강",
  381. LIFESTYLE: "라이프스타일",
  382. TECH_ELECTRONICS: "테크·가전",
  383. SPORTS_LEISURE: "스포츠·레저",
  384. CULTURE_ENTERTAINMENT: "문화·엔터테인먼트",
  385. };
  386. return names[category] || category;
  387. };
  388. const getPartnershipColor = (level) => {
  389. const colors = {
  390. PLATINUM: "purple",
  391. GOLD: "amber",
  392. SILVER: "grey",
  393. BRONZE: "brown",
  394. BASIC: "blue-grey",
  395. };
  396. return colors[level] || "grey";
  397. };
  398. const getPartnershipName = (level) => {
  399. const names = {
  400. PLATINUM: "플래티넘",
  401. GOLD: "골드",
  402. SILVER: "실버",
  403. BRONZE: "브론즈",
  404. BASIC: "베이직",
  405. };
  406. return names[level] || level;
  407. };
  408. const formatDate = (dateString) => {
  409. if (!dateString) return null;
  410. return new Date(dateString).toLocaleDateString("ko-KR");
  411. };
  412. const formatCurrency = (amount) => {
  413. if (!amount) return null;
  414. return new Intl.NumberFormat("ko-KR", {
  415. style: "currency",
  416. currency: "KRW",
  417. }).format(amount);
  418. };
  419. /************************************************************************
  420. | 라이프사이클
  421. ************************************************************************/
  422. onMounted(async () => {
  423. console.log("컴포넌트 마운트됨");
  424. console.log("vendorsStore:", vendorsStore);
  425. console.log("vendorsStore.getCurrentVendor:", vendorsStore.getCurrentVendor);
  426. console.log("vendorsStore.getLoading:", vendorsStore.getLoading);
  427. console.log("vendorsStore.getError:", vendorsStore.getError);
  428. const vendorId = route.params.id;
  429. console.log("vendorId:", vendorId);
  430. if (vendorId) {
  431. try {
  432. console.log("API 호출 시작");
  433. await vendorsStore.getVendorById(vendorId);
  434. console.log("API 호출 완료");
  435. console.log("currentVendor 값:", vendorsStore.getCurrentVendor);
  436. } catch (error) {
  437. console.error("벤더사 정보 로드 실패:", error);
  438. }
  439. }
  440. });
  441. </script>
  442. <style scoped>
  443. .vendor-detail-wrap {
  444. display: flex;
  445. flex-direction: column;
  446. gap: 20px;
  447. }
  448. .vendor-header-card {
  449. margin-bottom: 20px;
  450. }
  451. .vendor-header {
  452. display: flex;
  453. align-items: flex-start;
  454. gap: 20px;
  455. }
  456. .vendor-logo-section {
  457. flex-shrink: 0;
  458. }
  459. .vendor-logo-large {
  460. border: 1px solid #e0e0e0;
  461. }
  462. .no-logo-large {
  463. background: #f5f5f5;
  464. color: #666;
  465. font-weight: bold;
  466. font-size: 32px;
  467. display: flex;
  468. align-items: center;
  469. justify-content: center;
  470. width: 100%;
  471. height: 100%;
  472. }
  473. .vendor-info-section {
  474. flex: 1;
  475. }
  476. .vendor-name {
  477. font-size: 28px;
  478. font-weight: bold;
  479. margin-bottom: 12px;
  480. }
  481. .vendor-meta {
  482. margin-bottom: 16px;
  483. }
  484. .vendor-description {
  485. color: #666;
  486. line-height: 1.6;
  487. margin: 0;
  488. }
  489. .vendor-actions {
  490. flex-shrink: 0;
  491. }
  492. .breadcrumb-link {
  493. cursor: pointer;
  494. color: #1976d2;
  495. }
  496. .breadcrumb-link:hover {
  497. text-decoration: underline;
  498. }
  499. .detail-tabs-card {
  500. margin-top: 20px;
  501. }
  502. .info-section,
  503. .contact-section,
  504. .products-section,
  505. .partnership-section {
  506. padding: 20px 0;
  507. }
  508. .info-item {
  509. margin-bottom: 24px;
  510. }
  511. .info-item h3 {
  512. font-size: 16px;
  513. font-weight: 600;
  514. margin-bottom: 8px;
  515. color: #333;
  516. }
  517. .info-item p {
  518. font-size: 14px;
  519. color: #666;
  520. margin: 0;
  521. }
  522. .contact-card {
  523. height: 100%;
  524. }
  525. .contact-item {
  526. margin-bottom: 12px;
  527. }
  528. .contact-item strong {
  529. display: inline-block;
  530. width: 80px;
  531. color: #333;
  532. }
  533. .contact-item a {
  534. color: #1976d2;
  535. text-decoration: none;
  536. }
  537. .contact-item a:hover {
  538. text-decoration: underline;
  539. }
  540. .section-header {
  541. margin-bottom: 20px;
  542. padding-bottom: 10px;
  543. border-bottom: 1px solid #e0e0e0;
  544. }
  545. .section-header h3 {
  546. font-size: 18px;
  547. font-weight: 600;
  548. margin: 0;
  549. }
  550. .product-card {
  551. height: 100%;
  552. }
  553. .product-price {
  554. font-weight: bold;
  555. color: #1976d2;
  556. margin-top: 8px;
  557. }
  558. .rating {
  559. display: flex;
  560. align-items: center;
  561. gap: 8px;
  562. }
  563. .rating-text {
  564. font-size: 14px;
  565. color: #666;
  566. }
  567. .business-areas {
  568. display: flex;
  569. flex-wrap: wrap;
  570. gap: 8px;
  571. }
  572. .loading-wrap,
  573. .error-wrap,
  574. .no-data-wrap {
  575. display: flex;
  576. flex-direction: column;
  577. align-items: center;
  578. justify-content: center;
  579. padding: 60px 20px;
  580. }
  581. .no-data {
  582. text-align: center;
  583. }
  584. .no-data h3 {
  585. margin: 16px 0 8px;
  586. color: #666;
  587. }
  588. .no-data p {
  589. color: #999;
  590. margin-bottom: 20px;
  591. }
  592. @media (max-width: 768px) {
  593. .vendor-header {
  594. flex-direction: column;
  595. }
  596. .vendor-actions {
  597. width: 100%;
  598. }
  599. }
  600. </style>